package com.LostAndFound.service;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import com.LostAndFound.dao.SystemInfoDao;
import com.LostAndFound.domain.SystemInfo;

public class SystemInfoService {
	SystemInfoDao dao = new SystemInfoDao();

	// 分页，得到记录的总条数
	public int getTotalInfoForEasyUI() {
		int total = 0;
		try {
			total = dao.getTotalInfoForEasyUI();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return total;
	}
	// 分页，limit查询
	public List<Map<String, Object>> getInfoListForEasyUI(int pageNumber, int pageSize) {
		List<Map<String, Object>> mapList = null;
		int startIndex = 0 ;
		startIndex = (pageNumber-1)*pageSize;
		try {
			mapList = dao.getInfoListForEasyUI(startIndex,pageSize);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return mapList;
	}
	public boolean handleDeleteSystemInfoForEasyUI(String infoid) {
		boolean success = false;
		try {
			dao.handleDeleteSystemInfoForEasyUI(infoid);
			success = true;
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return success;
	}
	public boolean handleAddSystemInfo(SystemInfo systemInfo) {
		boolean success = false;
		try {
			dao.handleAddSystemInfo(systemInfo);
			success = true;
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return success;
	}

}
